/**
 * 教师考勤模块路由文件
 */

const Router = require('koa-router');
const router = new Router();
const { validAdd, validApply, validSearch, validAudit, validUpdateMyAttendance } = require('../validators/teacher_attendance_audit');
const { validate } = require('../validators/common');
const { addFlow, geAuditList, updateFlow, deleteFlow, apply, searchMyAttendanceList, searchNeedAuditApplies, getFlows, audit, getMyFlows, updateMyFlow } = require('../services/teacher_attendance_audit');

router.prefix('/attendance');

router.post('/add', validate(validAdd), addFlow);

router.put('/update', validate(validAdd), updateFlow);

router.get('/list', geAuditList);

router.delete('/delete/:type', deleteFlow);

router.post('/apply', validate(validApply), apply);

router.get('/search', validate(validSearch), searchMyAttendanceList);

router.get('/applies', searchNeedAuditApplies);

router.get('/flows/:id', getFlows);

router.get('/myFlows/:id', getMyFlows);

router.put('/audit', validate(validAudit), audit);

router.put('/updateMyFlow', validate(validUpdateMyAttendance), updateMyFlow);

module.exports = router;